<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
<script src="ajax.js"></script>
<script>
	let p = new Promise(function (resolve,reject) {
	  //异步代码
	  // resolve -成功了
	  // reject - 失败了
	  $.ajax({
	      url:"arr.txt",
	      type:"get",
	      success(arr){
	          resolve(arr);
	      },
	      error(err){
	        reject(err);
	      }
	  })
	});
	p.then(function (arr) {
	  alert('成功了'+arr);
	},function (err) {
		alert('失败了'+err);
	})

</script>
</body>
</html>